home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: rich@kastle.com (Richard Krehbiel)
- Newsgroups: comp.lang.c.moderated,comp.lang.c
- Subject: Re: ada-like naming scheme?
- Date: 26 Mar 1996 18:55:41 -0600
- Organization: Kastle Development Associates
- Sender: clc@solutions.solon.com
- Approved: clc@solutions.solon.com
- Message-ID: <4ja3md$p5e@solutions.solon.com>
- References: <4j41gd$nij@solutions.solon.com>
- Reply-To: rich@kastle.com
- NNTP-Posting-Host: solutions.solon.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- lloyd@upsilon.cs.fsu.edu (Justin C Lloyd) wrote:
-
- >Does anyone know how to do write a .c file so that you have to include the
- >name of c file in any function calls, similar to ada?
-
- There's no automatic way to do this. You will have to do it by
- adopting some convention.
-
- >In ada, for instance:
-
- > ada.text_io.get(x);
-
- >means there is a collection of procedures named ada (a package), and in that
- >one named text_io, and in the text_io collection, one called get.
-
- >Maybe a way to do this by putting everything in a struct? For instance...
-
- > float_sort.quicksort(float_array);
- > integer_sort.quicksort(int_array);
- > integer_sort.selection_sort(int_array);
-
- You could do just that...
-
- typedef int (*int_sort_fp)(int *), int_sort_f();
- typedef int (*float_sort_fp)(float *), float_sort_f();
-
- extern int_sort_f int_sort_quicksort;
- extern float_sort_f float_sort_quicksort;
-
- struct
- {
- int_sort_fp quicksort;
- } int_sort = { int_sort_quicksort };
-
- struct
- {
- float_sort_fp quicksort;
- } float_sort = { float_sort_quicksort };
-
- >From curiosity, why not just adopt a naming convention that prepends
- the package/module names to the function name? Why not simply call
- them int_sort_quicksort() and float_sort_quicksort()?
-
- --
- Richard Krehbiel, Kastle Systems, Arlington VA USA
- rich@kastle.com (work) or richk@mnsinc.com (personal)
-